Release 10.1A: OpenEdge Development:
Progress 4GL Reference
DO statement
Groups statements into a single block, optionally specifying processing services or block properties. Use an END statement to end a DO block.
Syntax
FORrecord[ ,record] ...Names the buffer you want to work with in the block and scopes the buffer to the block. The scope of a record determines when the buffer for that record is cleared and written back to the database. See OpenEdge Development: Progress 4GL Handbook for more information on record scoping.
To work with a record in a table defined for multiple databases, you must qualify the record’s table name with the database name. See the Record phrase reference entry for more information.
preselect-phraseThe PRESELECT phrase finds selected records from one or more tables. You can access those preselected records with statements such as FIND NEXT.
For more information, see the PRESELECT phrase reference entry.
query-tuning-phraseAllows programmatic control over the execution of a DataServer query.
For more information, see the OpenEdge DataServer Guides, OpenEdge Data Management: DataServer for Microsoft SQL Server , OpenEdge Data Management: DataServer for ODBC , and OpenEdge Data Management: DataServer for ORACLE .
variable=expression1TOexpression2[ BYk]The name of a field or variable whose value is incremented in a loop. The
expression1is the starting value forvariableon the first iteration of the loop. Thekis the amount to add tovariableafter each iteration, and it must be a constant. Thekdefaults to 1. Thevariable, expression1andexpression2must be integers.When
variableexceedsexpression2(or is less thanexpression2ifkis negative) the loop ends. Sinceexpression1is compared toexpression2at the start of the first iteration of the block, the block can be executed zero times. Theexpression2is re-evaluated on each iteration of the block.WHILEexpressionIndicates that the DO block continues processing the statements within it. Using the WHILE option turns a DO block into an iterating block. The block iterates as long as the condition specified by the expression is TRUE. The expression is any combination of constants, operators, field names, and variable names that yield a logical value.
TRANSACTIONIdentifies the DO block as a system transaction block. Progress starts a system transaction for each iteration of a transaction block if there is not already an active system transaction. See OpenEdge Development: Progress 4GL Handbook for more information on transactions.
on-endkey-phraseDescribes the processing that takes place when the ENDKEY condition occurs during a block. This is the syntax for a ON ENDKEY phrase:
For more information, see the ON ENDKEY phrase reference entry.
on-error-phraseDescribes the processing that takes place when there is an error during a block. This is the syntax for ON ERROR phrase:
For more information, see the ON ERROR phrase reference entry.
on-quit-phraseDescribes the processing that takes place when a QUIT statement is executed during a block. This is the syntax for ON QUIT phrase:
For more information, see the ON QUIT phrase reference entry.
on-stop-phraseDescribes the processing that takes place when the STOP conditions occurs during a block. This is the syntax for the ON STOP phrase:
For more information, see the ON STOP phrase reference entry.
frame-phraseSpecifies the overall layout and processing properties of a frame. For more information on
Exampleframe-phrase, see the Frame phrase reference entry.This procedure goes through the customer table and, for those customers whose credit-limit is over 80000, reduces credit-limit to 80000. The procedure uses an unmodified DO block to process two statements if credit-limit is over 80000. Unmodified DO blocks are most useful in conditional, or IF. . .THEN. . .ELSE situations.
Notes
- Use a DO statement rather than a REPEAT statement when you loop through each element of an array. This way Progress does not create separate subtransactions within a transaction.
For example, the first transaction is more efficient then the second:
- For SpeedScript, the
on-endkey-phraseand theon-quit-phrasedo not apply.See also
FIND statement, FOR statement, Frame phrase, ON ENDKEY phrase, ON ERROR phrase, ON QUIT phrase, ON STOP phrase, Record phrase, REPEAT statement
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |